package com.base.sdk.util;

import android.content.Context;

import com.base.sdk.base.api.PositiveOrCancelInterface;
import com.flyco.dialog.listener.OnBtnClickL;
import com.flyco.dialog.widget.MaterialDialog;

public class DialogUtil {

    public static void showDialog(Context context, String msg, final PositiveOrCancelInterface result) {
        if (context != null) {
            final MaterialDialog dialog = new MaterialDialog(context);
            dialog.title(msg);
            dialog.setCanceledOnTouchOutside(true);
            dialog.setOnBtnClickL(
                    new OnBtnClickL() {
                        @Override
                        public void onBtnClick() {
                            dialog.dismiss();
                            result.result(false);
                        }
                    },
                    new OnBtnClickL() {
                        @Override
                        public void onBtnClick() {
                            dialog.dismiss();
                            result.result(true);
                        }
                    });
            dialog.show();
        }
    }
}
